import request from '@/utils/request.js'

// 封装一个新闻推荐的接口
export const articleList = (params) => {
  return request({
    url: '/v1_0/articles',
    params
  })
}

// 封装一个新闻详情的接口
export const articleInfo = (id) => {
  return request({
    url: `/v1_0/articles/${id}`
  })
}

// 对文章点赞
export const zan = (data) => {
  return request({
    url: '/v1_0/article/likings',
    method: 'post',
    data
  })
}

// 取消点赞
export const unZan = (id) => {
  return request({
    url: '/v1_0/article/likings/' + id,
    method: 'delete'
  })
}

// 对文章不喜欢
export const unlike = (data) => {
  return request({
    url: '/v1_0/article/dislikes',
    method: 'post',
    data
  })
}

// 取消对文章的不喜欢
export const cancelLike = (id) => {
  return request({
    url: '/v1_0/article/dislikes/' + id,
    method: 'delete'
  })
}
